<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
function mp($arr){
	echo "<pre>";
	print_r($arr);
	echo "</pre>";
	exit();
}
function mp1($arr){
	echo "<pre>";
	print_r($arr);
	echo "</pre>";
}
    function findjrid($bet,$colums,$bets){
        // 降赔率
        if($bet==1&&$bets<49){
            $id=1;
        }
       if($bet==1&&$bets>=52&&$bets<=53){
            // 特码单双
            $id = 2;
        }
        if($bet==1&&$bets>=54&&$bets<=55){
            // 特码大小
            $id = 3;
        }
        if($bet==1&&$bets>=56&&$bets<=57){
            // 特码合码单双
            $id = 4;
        }
         if($bet==2){
            // 正码
            $id = 5;
        } if($bet==1&&$bets>=58&&$bets<=59){
            // 总和单双
            $id = 6;
        } if($bet==1&&$bets>=60&&$bets<=61){
            // 总和大小
            $id = 7;
        } if($bet==1&&$bets>=62&&$bets<=64){
            // 特码色波
            $id = 8;
        } if($bet==6&&$bets>=1&&$bets<=12){
            // 特码生肖
            $id = 9;
        } if($bet==4){
            if($bets==1||$bets==2||$bets==10||$bets==11||$bets==19||$bets==20||$bets==28||$bets==29||$bets==37||$bets==38||$bets==46||$bets==47){
                // 正码1-6单双
                $id = 10;
            }
        } if($bet==4){
            if($bets==3||$bets==4||$bets==12||$bets==13||$bets==21||$bets==22||$bets==30||$bets==31||$bets==39||$bets==40||$bets==48||$bets==49){
                 // 正码1-6大小
                $id = 11;
            }
           
        } if($bet==4){
            if($bets==5||$bets==6||$bets==7||$bets==14||$bets==15||$bets==16||$bets==23||$bets==24||$bets==32||$bets==33||$bets==34||$bets==41||$bets==42||$bets==43||$bets==50||$bets==51||$bets==52){
                // 正码1-6色波
                $id = 12;
            }
        } if($bet==4){
            if($bets==8||$bets==9||$bets==17||$bets==18||$bets=26||$bets==27||$bets==35||$bets==36||$bets==44||$bets==45||$bets==53||$bets==54){
                // 正码1-6合单双
                $id = 13;
            }
        } if($bet==8&&$bets>=1&&$bets<=12){
            // 半波
            $id = 14;
        }
        if($bet==13&&$colums==1){
            // 一肖【中】
            $id = 15;
        } if($bet==13&&$bets>=13&&$bets<=22){
            // 尾数
            $id = 16;
        }
        if($bet==13&&$bets>=23&&$bets<=26){
            //七色波 
            $id = 17;
        } 
        if($bet==3){
            //正码特 
            $id = 18;
        } if($bet==1&&$bets>=65&&$bets<=66){
            //特码合数大小
            $id = 19;
        } if($bet==1&&$bets>=56&&$bets<=57){
            // 特码合码单双
            $id = 20;
        } if($bet==1&&$bets>=67&&$bets<=70){
            //  特码半特
            $id = 21;
        } if($bet==6&&$bets>=13&&$bets<=17){
            //特码头数 
            $id = 22;
        } if($bet==6&&$bets>=18&&$bets<=23){
            //特码尾数
            $id = 23;
        } if($bet==9&&$bets>=13&&$bets<=16){
            // 总肖
            $id = 24;
        } if($bet==1&&$bets>=17&&$bets<=18){
            // 总肖单双 
            $id = 25;
        } if($bet==9){
            //正肖
            $id = 26;
        }
         if($bet==13&&$colums==2){
            //一肖[不中] 
            $id = 27;
        } 
        return $id;
    }
// 注单查询判断各种玩法的种类
    function redckout($type){
        $res = [];
        switch($type){

        case 1:
        // 特码B
        $res["bet"] = 1;
        $res['colums'] = 2;
        break;

        case 2:
        //特码A
        $res["bet"] = 1;
        $res['colums'] = 1;
        break;

        case 3:
        //特码单双
        $res["bet"] = 1;
        $res["colums"] = 1;
        $res["bets"][0] = 52;
        $res["bets"][1] = 53;
        break;
        
        case 4:
        //特码大小
        $res["bet"] = 1;
        $res['colums'] = 1;
        $res["bets"][0] = 54;
        $res["bets"][1] = 55;
        break;

        case 5:
        //特码合码单双
        $res["bet"] = 1;
        $res['colums'] = 1;
        $res["bets"][0] = 56;
        $res["bets"][1] = 57;
        break;

        case 6:
        //正码
        $res["bet"] = 2;
        $res['colums'] = 1;
        break;

        case 7:
        //总和单双
        $res["bet"] = 1;
        $res['colums'] = 1;
        $res['bets'][0]=58;
        $res['bets'][1]=59;
        break;

        case 8:
        //总和大小
        $res["bet"] = 1;
        $res['colums'] = 1;
        $res['bets'][0]=60;
        $res['bets'][1]=61;
        break;

        case 9:
        //特码色波
        $res["bet"] = 1;
        $res['colums'] = 1;
        $res['bets'][0]=62;
        $res['bets'][1]=63;
        $res['bets'][2]=64;
        break;

        case 10:
        //特码生肖
        $res["bet"] = 6;
        $res['colums'] = 1;
        $res['bets'][0]=1;
        $res['bets'][1]=2;
        $res['bets'][2]=3;
        $res['bets'][3]=4;
        $res['bets'][4]=5;
        $res['bets'][5]=6;
        $res['bets'][6]=7;
        $res['bets'][7]=8;
        $res['bets'][8]=9;
        $res['bets'][9]=10;
        $res['bets'][10]=11;
        $res['bets'][11]=12;        
        break;

        case 11:
        //正码1-6单双
        $res["bet"] = 4;
        $res['colums'] = 1;
        $res['bets'][0]=1;
        $res['bets'][1]=2;
        $res['bets'][2]=10;
        $res['bets'][3]=11;
        $res['bets'][4]=19;
        $res['bets'][5]=20;
        $res['bets'][6]=28;
        $res['bets'][7]=29;
        $res['bets'][8]=37;
        $res['bets'][9]=38;
        $res['bets'][10]=46;
        $res['bets'][11]=47;
        break;

        case 12:
        //正码1-6大小
        $res["bet"] = 4;
        $res['colums'] = 1;
        $res['bets'][0]=3;
        $res['bets'][1]=4;
        $res['bets'][2]=12;
        $res['bets'][3]=13;
        $res['bets'][4]=21;
        $res['bets'][5]=22;
        $res['bets'][6]=30;
        $res['bets'][7]=31;
        $res['bets'][8]=39;
        $res['bets'][9]=40;
        $res['bets'][10]=48;
        $res['bets'][11]=49;
        break;

        case 13:
        //正码1-6色波
        $res["bet"] = 4;
        $res['colums'] = 1;
        $res['bets'][0]=5;
        $res['bets'][1]=6;
        $res['bets'][2]=7;
        $res['bets'][3]=14;
        $res['bets'][4]=15;
        $res['bets'][5]=16;
        $res['bets'][6]=23;
        $res['bets'][7]=24;
        $res['bets'][8]=25;
        $res['bets'][9]=32;
        $res['bets'][10]=33;
        $res['bets'][11]=34;
        $res['bets'][12]=41;
        $res['bets'][13]=42;
        $res['bets'][14]=43;
        $res['bets'][15] = 50;
        $res['bets'][16] = 51;
        $res['bets'][17] = 52;        
        break;
        case 14:
        //正码1-6合单双
        $res["bet"] = 4;
        $res['colums'] = 1;
        $res['bets'][0]=8;
        $res['bets'][1]=9;
        $res['bets'][2]=17;
        $res['bets'][3]=18;
        $res['bets'][4]=26;
        $res['bets'][5]=27;
        $res['bets'][6]=35;
        $res['bets'][7]=36;
        $res['bets'][8]=44;
        $res['bets'][9]=45;
        $res['bets'][10]=53;
        $res['bets'][11]=54;
        break;

        case 15:
        //半波
        $res["bet"] = 8;
        $res['colums'] = 1;
        $res['bets'][0]=1;
        $res['bets'][1]=2;
        $res['bets'][2]=3;
        $res['bets'][3]=4;
        $res['bets'][4]=5;
        $res['bets'][5]=6;
        $res['bets'][6]=7;
        $res['bets'][7]=8;
        $res['bets'][8]=9;
        $res['bets'][9]=10;
        $res['bets'][10]=11;
        $res['bets'][11]=12; 
        break;

        case 16:
        //多肖
        $res["bet"] = 12;
        $res['colums'] = 1;
        $res['bets'][0]=1;
        $res['bets'][1]=2;
        $res['bets'][2]=3;
        $res['bets'][3]=4;
        $res['bets'][4]=5;
        $res['bets'][5]=6;
        $res['bets'][6]=7;
        $res['bets'][7]=8;
        $res['bets'][8]=9;
        $res['bets'][9]=10;
        $res['bets'][10]=11;
        $res['bets'][11]=12;
        break;

        case 17:
        //一肖[中]
        $res["bet"] = 13;
        $res['colums'] = 1;
        break;

        case 18:
        //尾数
        $res["bet"] = 13;
        $res['colums'] = 1;
        $res['bets'][0]=13;
        $res['bets'][1]=14;
        $res['bets'][2]=15;
        $res['bets'][3]=16;
        $res['bets'][4]=17;
        $res['bets'][5]=18;
        $res['bets'][6]=19;
        $res['bets'][7]=20;
        $res['bets'][8]=21;
        $res['bets'][9]=22;        
        break;

        case 19:
        //三全中
        $res["bet"] = 7;
        $res['colums'] = 1;
        break;

        case 20:
        //三中二
        $res["bet"] = 7;
        $res['colums'] = 2;
        break;

        case 21:
        //二全中
        $res["bet"] = 7;
        $res['colums'] = 4;
        break;

        case 22:
        //二中特
        $res["bet"] = 7;
        $res['colums'] = 5;
        break;

        case 23:
        //特串
        $res["bet"] = 7;
        $res['colums'] = 7;
        break;

        case 24:
        //七色波
        $res["bet"] = 13;
        $res['colums'] = 1;
        $res['bets'][0]=23;
        $res['bets'][1]=24;
        $res['bets'][2]=25;  
        $res['bets'][3]=26; 
        break;
        
        case 25:
        //正码特
        $res["bet"] = 3;
        break;

        case 26:
        //特码合码大小
        $res["bet"] = 1;
        $res['colums'] = 1;
        $res['bets'][0]=65; 
        $res['bets'][1]=66; 
        break;

        case 27:
        //特码尾数大小
        $res["bet"] = 1;
        $res['colums'] = 1;
        $res['bets'][0]=50; 
        $res['bets'][1]=51;
        break;

        case 28:
        //特码半特
        $res["bet"] = 1;
        $res['colums'] = 1;
        $res['bets'][0]=67; 
        $res['bets'][1]=68;        
        $res['bets'][2]=69; 
        $res['bets'][3]=70;        
        break;

        case 29:
        //特码头数
        $res["bet"] = 6;
        $res['colums'] = 1;
        $res['bets'][0]=13; 
        $res['bets'][1]=14;        
        $res['bets'][2]=15; 
        $res['bets'][3]=16;
        $res['bets'][4]=17;  
        break;

        case 30:
        //特码尾数
        $res["bet"] = 6;
        $res['colums'] = 1;
        $res['bets'][0]=18; 
        $res['bets'][1]=19;        
        $res['bets'][2]=20; 
        $res['bets'][3]=21;
        $res['bets'][4]=22;
        $res['bets'][5]=23; 
        
        break;

        case 31:
        //总肖
        $res["bet"] = 9;
        $res['bets'][0]=13;        
        $res['bets'][1]=14; 
        $res['bets'][2]=15;
        $res['bets'][3]=16;

        break;

        case 32:
        //总肖单双
        $res["bet"] = 1;
        $res['colums'] = 1;
        $res['bets'][0] = 17;
        $res['bets'][1] = 18;
        break;

        case 33:
        //正肖
        $res["bet"] = 9;
        $res['colums'] = 1;
        break;

        case 34:
        //连肖
        $res["bet"] = 10;
        $res['colums'] = 1;
        break;

        case 35:
        //正码过关
        $res["bet"] = 5;
        $res['colums'] = 1;
        break;

        case 36:
        //5不中
        $res["bet"] = 14;
        $res['colums'] = 1;
        break;

        case 37:
        //6不中
        $res["bet"] = 14;
        $res['colums'] = 2;
        break;

        case 38:
        //7不中
        $res["bet"] = 14;
        $res['colums'] = 3;
        break;

        case 39:
        //8不中
        $res["bet"] = 14;
        $res['colums'] = 4;
        break;

        case 40:
        //9不中
        $res["bet"] = 14;
        $res['colums'] = 5;
        break;

        case 41:
        //10不中
        $res["bet"] = 14;
        $res['colums'] = 6;
        break;

        case 42:
        //11不中
        $res["bet"] = 14;
        $res['colums'] = 7;
        break;

        case 43:
        //12不中
        $res["bet"] = 14;
        $res['colums'] = 8;
        break;

        case 44:
        //3中一
        $res["bet"] = 15;
        $res['colums'] = 1;
        break;

        case 45:
        //4中一
        $res["bet"] = 15;
        $res['colums'] = 2;
        break;

        case 46:
        //5中一
        $res["bet"] = 15;
        $res['colums'] = 3;
        break;

        case 47:
        //6中一
        $res["bet"] = 15;
        $res['colums'] = 4;
        break;

        case 48:
        //一肖[不中]
        $res["bet"] = 13;
        $res['colums'] = 2;
        break;

        case 49:
        //尾数连
        $res["bet"] = 11;
        $res['colums'] = 1;
        $res['bets'][0]=1; 
        $res['bets'][1]=2;        
        $res['bets'][2]=3; 
        $res['bets'][3]=4;
        $res['bets'][4]=5;
        $res['bets'][5]=6; 
        $res['bets'][6]=7;        
        $res['bets'][7]=8; 
        $res['bets'][8]=9;
        $res['bets'][9]=10;
        break;
        case 50:
        //七码
        $res["bet"] = 14;
        $res['colums'] = 6;
        $res['bets'][0]=1; 
        $res['bets'][1]=2;        
        $res['bets'][2]=3; 
        $res['bets'][3]=4;
        $res['bets'][4]=5;
        $res['bets'][5]=6; 
        $res['bets'][6]=7;        
        $res['bets'][7]=8; 
        $res['bets'][8]=9;
        $res['bets'][9]=10;
        $res['bets'][10]=11; 
        $res['bets'][11]=12;        
        $res['bets'][12]=13; 
        $res['bets'][13]=14;
        $res['bets'][14]=15;
        $res['bets'][15]=16; 
        $res['bets'][16]=17;        
        $res['bets'][17]=18; 
        $res['bets'][18]=19;
        $res['bets'][19]=20;
        $res['bets'][20]=21; 
        $res['bets'][21]=22;        
        $res['bets'][22]=23; 
        $res['bets'][23]=24;
        $res['bets'][24]=25;
        $res['bets'][25]=26; 
        $res['bets'][26]=27;        
        $res['bets'][27]=28; 
        $res['bets'][28]=29;
        $res['bets'][29]=30;
        $res['bets'][30]=31;
        $res['bets'][31]=32;
        break;        
        }
        return $res;
    } 
    function restore($fname)
     {
           
         if (file_exists($fname)) {
          $sql_value="";
          $cg=0;
          $sb=0;
          $sqls=file($fname);
          foreach($sqls as $sql)
          {
          $sql_value.=$sql;
          }
          $a=explode(";\r\n", $sql_value); //根据";\r\n"条件对数据库中分条执行
          $total=count($a)-1;
          mysql_query("set names 'utf8'");
          for ($i=0;$i<$total;$i++)
          {
          mysql_query("set names 'utf8'");
          //执行命令
          if(mysql_query($a[$i]))
          {
           $cg+=1;
          }
          else
          {
           $sb+=1;
           $sb_command[$sb]=$a[$i];
          }
          }
          echo "操作完毕，共处理 $total 条命令，成功 $cg 条，失败 $sb 条";
          //显示错误信息
          if ($sb>0)
          {
          echo "<hr><br><br>失败命令如下：<br>";
          for ($ii=1;$ii<=$sb;$ii++)
          {
           echo "<p><b>第 ".$ii." 条命令（内容如下）：</b><br>".$sb_command[$ii]."</p><br>";
          }
          }  //-----------------------------------------------------------
         }else{
          echo "MySQL备份文件不存在，请检查文件路径是否正确！";
         }
     }
// 将内容放进最近的记录内容里
    // 58-61 是平码的
    // 62-64 是色波
    function inserpankous($bet,$colums,$bets,$name){
        // 判断玩法
        if($bet==1){
            
                if($bets<=49){
                    if($colums==1){
                        return $result ="特码A[".$name."]";
                           }else{
                        return $result ="特码B[".$name."]"; 
                    }
                }
                if($bets>49&&$bet<58)return $result ="特码[".$name."]";
                if($bets==58)return $result ="平码[".$name."]";
                if($bets==59)return $result ="平码[".$name."]";
                if($bets==60)return $result ="平码[".$name."]";
                if($bets==61)return $result ="平码[".$name."]";
                if($bets==62)return $result ="特码 红";
                if($bets==63)return $result ="特码 蓝";
                if($bets==64)return $result ="特码 绿";
                if($bets>=65&&$bets<=70)return $result ="特码A[".$name."]";
            
        }
        if($bet==2){
            return $result ="平码[".$name."]"; 
        }
        if($bet==3){
            if($colums==1){
                return $result ="正特一[".$name."]";
            }else if($colums==2){
                return $result ="正特二[".$name."]";
            }else if($colums==3){
                return $result ="正特三[".$name."]";
            }else if($colums==4){
                return $result ="正特四[".$name."]";
            }else if($colums==5){
                return $result ="正特五[".$name."]";
            }else{
                return $result ="正特六[".$name."]";
            }
        }
        if($bet==4){
                    if($bets<=9){
                       return $result = "正码一[".$name."]";
                    }
                    if($bets>9 && $bets<=18){
                       return $result = "正码二[".$name."]";
                    }
                    if($bets>18 && $bets<=27){
                       return $result = "正码三[".$name."]";
                    } 
                    if($bets>27 && $bets<=36){
                       return $result = "正码四[".$name."]";
                    }
                    if($bets>36 && $bets<=45){
                       return $result = "正码五[".$name."]";
                    }
                    if($bets>45 && $bets<=54){
                       return $result = "正码六[".$name."]";
                    }
                   
        }
         if($bet==5){
              return $result = "正码过关-正码一[".$bets."]";
        }
        if($bet==6){
            return $result = "特码".$name;
        }
        if($bet==7){
            if($colums==1){
                return $result = "连码[三全中]".$bets;
            }
            if($colums==2){
                return $result = "连码[三全二]".$bets;
            }
            if($colums==3){
                return $result = "连码[二全中]".$bets;
            }
            if($colums==4){
                return $result = "连码[二中特]".$bets;
            }
            if($colums==5){
                return $result = "连码[特串]".$bets;
            }
        }
        if($bet==8){
            return $result = "半波[".$name."]";
        }
        if($bet==9){
            return $result = "正肖总肖7码[".$name."]";
        }
        if($bet==10){
                $arr = explode(",",$bets);
                $betss = "";
                foreach ($arr as $k => $item) {
                    if($item==1){
                        $betss .= "鼠,";
                    }else if($item==2){
                        $betss .= "牛,";
                    }else if($item==3){
                        $betss .= "虎,";
                    }else if($item==4){
                        $betss .= "兔,";
                    }else if($item==5){
                        $betss .= "龙,";
                    }else if($item==6){
                        $betss .= "蛇,";
                    }else if($item==7){
                        $betss .= "马,";
                    }else if($item==8){
                        $betss .= "羊,";
                    }else if($item==9){
                        $betss .= "猴,";
                    }else if($item==10){
                        $betss .= "鸡,";
                    }else if($item==11){
                        $betss .= "狗,";
                    }else if($item==12){
                        $betss .= "猪,";
                    }
                }
                $betss = rtrim($betss, ',');
            if($colums==1){
                return $result = "连肖[二肖碰]".$betss;
            }
            if($colums==2){
                return $result = "连肖[三肖碰]".$betss;
            }
            if($colums==3){
                return $result = "连肖[四肖碰]".$betss;
            }
            if($colums==4){
                return $result = "连肖[五肖碰]".$betss;
            }
        }
        if($bet==11){
             $arr = explode(",",$bets);
             $betss = "";
                foreach ($arr as $k => $item) {
                    if($item==1){
                        $betss .= "0尾,";
                    }else if($item==2){
                        $betss .= "1尾,";
                    }else if($item==3){
                        $betss .= "2尾,";
                    }else if($item==4){
                        $betss .= "3尾,";
                    }else if($item==5){
                        $betss .= "4尾,";
                    }else if($item==6){
                        $betss .= "5尾,";
                    }else if($item==7){
                        $betss .= "6尾,";
                    }else if($item==8){
                        $betss .= "7尾,";
                    }else if($item==9){
                        $betss .= "8尾,";
                    }else if($item==10){
                        $betss .= "9尾,";
                    }
                }
                $betss = rtrim($betss, ',');
            if($colums==1){
                return $result = "尾数连[二尾连]".$betss;
            }
            if($colums==2){
                return $result = "尾数连[三尾连]".$betss;
            }
            if($colums==3){
                return $result = "尾数连[四尾连]".$betss;
            }
        }
        if($bet==12){
             $arr = explode(",",$bets);
                 $betss = "";
                foreach ($arr as $k => $item) {
                    if($item==1){
                        $betss .= "鼠,";
                    }else if($item==2){
                        $betss .= "牛,";
                    }else if($item==3){
                        $betss .= "虎,";
                    }else if($item==4){
                        $betss .= "兔,";
                    }else if($item==5){
                        $betss .= "龙,";
                    }else if($item==6){
                        $betss .= "蛇,";
                    }else if($item==7){
                        $betss .= "马,";
                    }else if($item==8){
                        $betss .= "羊,";
                    }else if($item==9){
                        $betss .= "猴,";
                    }else if($item==10){
                        $betss .= "鸡,";
                    }else if($item==11){
                        $betss .= "狗,";
                    }else if($item==12){
                        $betss .= "猪,";
                    }
                }
                $betss = rtrim($betss, ',');
            if($colums==1){
                return $result = "多肖[三肖]".$bets;
            }
            if($colums==2){
                return $result = "多肖[四肖]".$bets;
            }
            if($colums==3){
                return $result = "多肖[五肖]".$bets;
            }
            if($colums==4){
                return $result = "多肖[六肖]".$bets;
            }
        }
        if($bet==13){
            if($colums==1){
                return $result = "一肖尾数七色波[中]".$name;
            }
            if($colums==2){
                return $result = "一肖尾数七色波[不中]".$name;
            }
        }
        if($bet==14){
            if($colums==1){
                return $result = "全不中[5不中]".$bets;
            }
            if($colums==2){
                return $result = "全不中[6不中]".$bets;
            }
            if($colums==3){
                return $result = "全不中[7不中]".$bets;
            }
            if($colums==4){
                return $result = "全不中[8不中]".$bets;
            }
            if($colums==5){
                return $result = "全不中[9不中]".$bets;
            }
            if($colums==6){
                return $result = "全不中[10不中]".$bets;
            }
            if($colums==7){
                return $result = "全不中[11不中]".$bets;
            }
            if($colums==8){
                return $result = "全不中[12不中]".$bets;
            }
        }
        if($bet==15){
            if($colums==1){
                return $result = "多中一[3中1]".$bets;
            }
            if($colums==2){
                return $result = "多中一[4中1]".$bets;
            }
            if($colums==3){
                return $result = "多中一[5中1]".$bets;
            }
            if($colums==4){
                return $result = "多中一[6中1]".$bets;
            }
        }
    }
    function insertss($uid){
        // 退水表的插入
                     $data[] = [
                        "ts2"=>4.2,
                        "ts3"=>5.2,
                        'ts4'=>1,
                        "n"=>1,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>30000,
                        'ts'=>3.2,
                        'reduce'=>0,
                        'name'=>"特码B"
                    ];
                     $data[] = [
                        "ts2"=>14.2,
                        "ts3"=>15.2,
                        'ts4'=>1,
                        "n"=>2,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>30000,
                        'ts'=>13.2,
                        'reduce'=>0,
                        'name'=>"特码A"
                    ];
                     $data[] = [
                        "ts2"=>2.35,
                        "ts3"=>3.35,
                        'ts4'=>5,
                        "n"=>3,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.35,
                        'reduce'=>0,
                        'name'=>"特码单双"
                    ];
                     $data[] = [
                        "ts2"=>2.35,
                        "ts3"=>3.35,
                        'ts4'=>5,
                        "n"=>4,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.35,
                        'reduce'=>0,
                        'name'=>"特码大小"
                    ];
                     $data[] = [
                        "ts2"=>2.35,
                        "ts3"=>3.353,
                        'ts4'=>5,
                        "n"=>5,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.35,
                        'reduce'=>0,
                        'name'=>"特码合码单双"
                    ];
                     $data[] = [
                        "ts2"=>12.3,
                        "ts3"=>13.3,
                        'ts4'=>11.3,
                        "n"=>6,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>11.3,
                        'reduce'=>0,
                        'name'=>"正码"
                    ];
                     $data[] = [
                        "ts2"=>2.35,
                        "ts3"=>3.35,
                        'ts4'=>6,
                        "n"=>7,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.35,
                        'reduce'=>0,
                        'name'=>"总和单双"
                    ];
                     $data[] = [
                        "ts2"=>2.35,
                        "ts3"=>3.35,
                        'ts4'=>6,
                        "n"=>8,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.35,
                        'reduce'=>0,
                        'name'=>"总和大小"
                    ];
                     $data[] = [
                        "ts2"=>1.8,
                        "ts3"=>1.8,
                        'ts4'=>1.8,
                        "n"=>9,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.8,
                        'reduce'=>0,
                        'name'=>"特码色波"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>10,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"特码生肖"
                    ];
                     $data[] = [
                        "ts2"=>2.35,
                        "ts3"=>3.35,
                        'ts4'=>6,
                        "n"=>11,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.35,
                        'reduce'=>0,
                        'name'=>"正码1-6单双"
                    ];
                     $data[] = [
                        "ts2"=>2.35,
                        "ts3"=>3.35,
                        'ts4'=>6,
                        "n"=>12,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.35,
                        'reduce'=>0,
                        'name'=>"正码1-6大小"
                    ];
                     $data[] = [
                        "ts2"=>1.8,
                        "ts3"=>1.8,
                        'ts4'=>1.8,
                        "n"=>13,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.8,
                        'reduce'=>0,
                        'name'=>"正码1-6色波"
                    ];
                     $data[] = [
                        "ts2"=>2.35,
                        "ts3"=>3.35,
                        'ts4'=>6,
                        "n"=>14,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.35,
                        'reduce'=>0,
                        'name'=>"正码1-6合单双"
                    ];
                     $data[] = [
                        "ts2"=>1.8,
                        "ts3"=>1.8,
                        'ts4'=>1.8,
                        "n"=>15,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.8,
                        'reduce'=>0,
                        'name'=>"半波"
                    ];
                     $data[] = [
                        "ts2"=>3.3,
                        "ts3"=>4.3,
                        'ts4'=>1,
                        "n"=>16,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"多肖"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>17,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"一肖[中]"
                    ];
                     $data[] = [
                        "ts2"=>0.3,
                        "ts3"=>0.3,
                        'ts4'=>0.3,
                        "n"=>18,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>0.3,
                        'reduce'=>0,
                        'name'=>"尾数"
                    ];
                     $data[] = [
                        "ts2"=>15.05,
                        "ts3"=>15.05,
                        'ts4'=>15.05,
                        "n"=>19,
                        'uid'=>$uid,
                        'limitnum'=>10000,
                        'limits'=>1000,
                        'ts'=>15.05,
                        'reduce'=>0,
                        'name'=>"三全中"
                    ];
                     $data[] = [
                        "ts2"=>15.05,
                        "ts3"=>15.05,
                        'ts4'=>15.05,
                        "n"=>20,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>5000,
                        'ts'=>15.05,
                        'reduce'=>0,
                        'name'=>"三中二"
                    ];
                     $data[] = [
                        "ts2"=>15.05,
                        "ts3"=>15.05,
                        'ts4'=>15.05,
                        "n"=>21,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>5000,
                        'ts'=>15.05,
                        'reduce'=>0,
                        'name'=>"二全中"
                    ];
                     $data[] = [
                        "ts2"=>15.05,
                        "ts3"=>15.05,
                        'ts4'=>15.05,
                        "n"=>22,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>5000,
                        'ts'=>15.05,
                        'reduce'=>0,
                        'name'=>"二中特"
                    ];
                     $data[] = [
                        "ts2"=>15.05,
                        "ts3"=>15.05,
                        'ts4'=>15.05,
                        "n"=>23,
                        'uid'=>$uid,
                        'limitnum'=>10000,
                        'limits'=>5000,
                        'ts'=>15.05,
                        'reduce'=>0,
                        'name'=>"特串"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>24,
                        'uid'=>$uid,
                        'limitnum'=>50000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"七色波"
                    ];
                     $data[] = [
                        "ts2"=>14.3,
                        "ts3"=>15.3,
                        'ts4'=>1,
                        "n"=>25,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>13.3,
                        'reduce'=>0,
                        'name'=>"正码特"
                    ];
                     $data[] = [
                        "ts2"=>3.3,
                        "ts3"=>4.3,
                        'ts4'=>6,
                        "n"=>26,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"特码合码大小"
                    ];
                     $data[] = [
                        "ts2"=>3.3,
                        "ts3"=>4.3,
                        'ts4'=>6,
                        "n"=>27,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"特码合码单双"
                    ];
                     $data[] = [
                        "ts2"=>2.3,
                        "ts3"=>2.3,
                        'ts4'=>2.3,
                        "n"=>28,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"特码半特"
                    ];
                     $data[] = [
                        "ts2"=>2.3,
                        "ts3"=>2.3,
                        'ts4'=>2.3,
                        "n"=>29,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"特码头数"
                    ];
                     $data[] = [
                        "ts2"=>2.3,
                        "ts3"=>2.3,
                        'ts4'=>2.3,
                        "n"=>30,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"特码尾数"
                    ];
                     $data[] = [
                        "ts2"=>2.3,
                        "ts3"=>2.3,
                        'ts4'=>2.3,
                        "n"=>31,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"总肖"
                    ];
                     $data[] = [
                        "ts2"=>3.3,
                        "ts3"=>4.3,
                        'ts4'=>2.3,
                        "n"=>32,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"总肖单双"
                    ];
                     $data[] = [
                        "ts2"=>2.3,
                        "ts3"=>2.3,
                        'ts4'=>2.3,
                        "n"=>33,
                        'uid'=>$uid,
                        'limitnum'=>500000,
                        'limits'=>500000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"正肖"
                    ];
                     $data[] = [
                        "ts2"=>1.5,
                        "ts3"=>1.5,
                        'ts4'=>1.5,
                        "n"=>34,
                        'uid'=>$uid,
                        'limitnum'=>50000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"连肖"
                    ];
                     $data[] = [
                        "ts2"=>2.3,
                        "ts3"=>2.3,
                        'ts4'=>2.3,
                        "n"=>35,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>2.3,
                        'reduce'=>0,
                        'name'=>"正码过关"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>36,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"5不中"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>37,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"6不中"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>38,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"7不中"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>39,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"8不中"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>40,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"9不中"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>41,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"10不中"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>42,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"11不中"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>43,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"12不中"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>44,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"3中一"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>45,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"4中一"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>46,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"5中一"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>47,
                        'uid'=>$uid,
                        'limitnum'=>100000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"6中一"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>48,
                        'uid'=>$uid,
                        'limitnum'=>200000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"一肖[不中]"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>49,
                        'uid'=>$uid,
                        'limitnum'=>50000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"尾数连"
                    ];
                     $data[] = [
                        "ts2"=>1.3,
                        "ts3"=>1.3,
                        'ts4'=>1.3,
                        "n"=>50,
                        'uid'=>$uid,
                        'limitnum'=>50000,
                        'limits'=>50000,
                        'ts'=>1.3,
                        'reduce'=>0,
                        'name'=>"七码"
                    ];
                    $data = json_encode($data);
                  return $data;
    }
    function getpancha($andicap,$bet,$colums,$bets){
        // 盘差
        switch ($andicap) {
            case 1:
                $n = 0;
                break;
            case 2:
                $n = 1;
                break;
            case 3:
                $n = 2;
                break;
            case 4:
                $n = 3;
                break;
            default:
              return 0;  
            break;
        }
        if($bet==1&&$colums==1&&$bets<=49){
            // 特码A
            $id = 1;
        }
        if($bet==1&&$bets>=52&&$bets<=53){
            // 特码单双
            $id = 2;
        }
        if($bet==1&&$bets>=54&&$bets<=55){
            // 特码大小
            $id = 3;
        }
        if($bet==1&&$bets>=56&&$bets<=57){
            // 特码合码单双
            $id = 4;
        }
         if($bet==2){
            // 正码
            $id = 5;
        } if($bet==1&&$bets>=58&&$bets<=59){
            // 总和单双
            $id = 6;
        } if($bet==1&&$bets>=60&&$bets<=61){
            // 总和大小
            $id = 7;
        } if($bet==1&&$bets>=62&&$bets<=64){
            // 特码色波
            $id = 8;
        } if($bet==6&&$bets>=1&&$bets<=12){
            // 特码生肖
            $id = 9;
        } if($bet==4){
            if($bets==1||$bets==2||$bets==10||$bets==11||$bets==19||$bets==20||$bets==28||$bets==29||$bets==37||$bets==38||$bets==46||$bets==47){
                // 正码1-6单双
                $id = 10;
            }
        } if($bet==4){
            if($bets==3||$bets==4||$bets==12||$bets==13||$bets==21||$bets==22||$bets==30||$bets==31||$bets==39||$bets==40||$bets==48||$bets==49){
                 // 正码1-6大小
                $id = 11;
            }
           
        } if($bet==4){
            if($bets==5||$bets==6||$bets==7||$bets==14||$bets==15||$bets==16||$bets==23||$bets==24||$bets==32||$bets==33||$bets==34||$bets==41||$bets==42||$bets==43||$bets==50||$bets==51||$bets==52){
                // 正码1-6色波
                $id = 12;
            }
        } if($bet==4){
            if($bets==8||$bets==9||$bets==17||$bets==18||$bets=26||$bets==27||$bets==35||$bets==36||$bets==44||$bets==45||$bets==53||$bets==54){
                // 正码1-6合单双
                $id = 13;
            }
        } if($bet==8&&$bets>=1&&$bets<=12){
            // 半波
            $id = 14;
        } if($bet==6&&$bets>=1&&$bets<=12){
            // 多肖
            $id = 15;
        } if($bet==13&&$colums==1){
            // 一肖【中】
            $id = 16;
        } if($bet==13&&$bets>=13&&$bets<=22){
            // 尾数
            $id = 17;
        } if($bet==7&&$colums==1){
            //三全中 
            $id = 18;
        } if($bet==7&&$colums==2){
            //三中二 
            $id = 19;
        } if($bet==7&&$colums==3){
            //二全中 
            $id = 20;
        } if($bet==7&&$colums==4){
            //二中特 
            $id = 21;
        } if($bet==7&&$colums==5){
            //特串 
            $id = 22;
        } if($bet==13&&$bets>=23&&$bets<=26){
            //七色波 
            $id = 23;
        } 
        if($bet==3){
            //正码特 
            $id = 24;
        } if($bet==1&&$bets>=65&&$bets<=66){
            //特码合数大小
            $id = 25;
        } if($bet==1&&$bets>=56&&$bets<=57){
            // 特码合码单双
            $id = 26;
        } if($bet==1&&$bets>=67&&$bets<=70){
            //  特码半特
            $id = 27;
        } if($bet==6&&$bets>=13&&$bets<=17){
            //特码头数 
            $id = 28;
        } if($bet==6&&$bets>=18&&$bets<=23){
            //特码尾数
            $id = 29;
        } if($bet==9&&$bets>=13&&$bets<=16){
            // 总肖
            $id = 30;
        } if($bet==1&&$bets>=17&&$bets<=18){
            // 总肖单双 
            $id = 31;
        } if($bet==9){
            //正肖
            $id = 32;
        } if($bet==10){
            //连肖 
            $id = 33;
        } if($bet==5){
            //正码过关  
            $id = 34;
        } if($bet==14&&$colums==1){
            //5不中
            $id = 35;
        } if($bet==14&&$colums==2){
            // 6不中 
            $id = 36;
        } if($bet==14&&$colums==3){
            //7不中
            $id = 37;
        } if($bet==14&&$colums==4){
            //8不中
            $id = 38;
        } if($bet==14&&$colums==5){
            // 9不中
            $id = 39;
        } if($bet==14&&$colums==6){
            // 10不中
            $id = 40;
        } if($bet==14&&$colums==7){
            // 11不中
            $id = 41;
        } if($bet==14&&$colums==8){
            // 12不中
            $id = 42;
        } if($bet==15&&$colums==1){
            // 3中一 
            $id = 43;
        } if($bet==15&&$colums==2){
            // 4中一 
            $id = 44;
        } if($bet==15&&$colums==3){
            // 5中一
            $id = 45;
        } if($bet==15&&$colums==4){
            //6中一
            $id =46;
        } if($bet==13&&$colums==2){
            //一肖[不中] 
            $id = 47;
        } 
        if($bet==11&&$bets>=1&&$bets<=10){
            // 尾数连
            $id= 48;
        }
        if($bet==9&&$bets>=19){
            //  7码
            $id= 49;
        }
        $data = [
            "id"=>$id,
            'n' =>$n
        ];
        $data = json_encode($data);
        return $data;
    }
function getSSNameByNum($num){
	$curYear = date('Y');
	$y = $curYear - 2018;
	$num = ($num+$y) % 12;
	switch ($num) {
		case 1:
			$name = '狗';
			break;

		case 2:
			$name = '猪';
			break;

		case 3:
			$name = '鼠';
			break;
		case 4:
			$name = '牛';
			break;
		case 5:
			$name = '虎';
			break;
		case 6:
			$name = '兔';
			break;
		case 7:
			$name = '龙';
			break;
		case 8:
			$name = '蛇';
			break;
		case 9:
			$name = '马';
			break;
		case 10:
			$name = '羊';
			break;
		case 11:
			$name = '猴';
			break;
		
		default:
			$name = '鸡';
			break;
	}
	return $name;
}
function getSSNameArray(){
	for($i = 1;$i<=49;$i++){
		$key = getSSNameByNum($i);
		$arr[$key][] = $i;
	}
	return $arr;
}
error_reporting(E_ERROR | E_WARNING | E_PARSE);
